from pathlib import Path

import yaml

class Config:
    def __init__(self, config_path=None):
        config_path = config_path or Path(__file__).parent / "config.yaml"
        with open(config_path, "r") as file:
            self.config = yaml.safe_load(file)

    def get_login_url(self):
        """
        获取登录页地址
        :return:
        """
        return self.config["web"]["login_url"]


    def get_sender(self):
        """
        获取发件人邮箱
        :return:
        """
        return self.config["email"]["sender"]

    def get_recipient(self):
        """
        获取收件人邮箱
        :return:
        """
        return self.config["email"]["recipient"]

    def get_authorization_code(self):
        """
        发件人邮箱授权码
        :return:
        """
        return self.config["email"]["authorization_code"]

    def get_host(self):
        """
        获取协议
        :return:
        """
        return self.config["email"]["host"]

    def get_port(self):
        """
        获取端口号
        :return:
        """
        return self.config["email"]["port"]




